package com.palmwindActivity.app.main;


import com.palmwindActivity.R;

import android.app.Activity;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.view.Window;

public class PalmwindActivity extends Activity {
	
	ViewGroup currentScreen;
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
        this.setTitle(R.string.main_title);
        this.setContentView(R.layout.mainscreen);
    }
    
	public void onStart() {
		super.onStart();
		SharedPreferences preference = this.getSharedPreferences("releaseall", 0);
    	boolean isRelease = preference.getBoolean("isRelease", false);
		if(isRelease)
		{
			Editor editor = preference.edit();
			editor.putBoolean("isRelease", false);
			editor.commit();
			finish();
		}
		
	}
    
    public void onConfigurationChanged (Configuration newConfig)
    {
    	super.onConfigurationChanged(newConfig);
    	
    }
    
    public boolean onCreateOptionsMenu (Menu menu)
    {
//    	MenuItem exitMenu = menu.add(0, MenuHandler.EXIT_ID, Menu.NONE, R.string.exit_str);
    	MenuItem nav_locally = menu.add(0, MenuHandler.NAV_LOCAL_ID, Menu.NONE, R.string.nav_local);
    	MenuItem nav_remote = menu.add(0, MenuHandler.NAV_REMOTE_ID, Menu.NONE, R.string.nav_remote);
    	MenuItem setting = menu.add(0, MenuHandler.SETTING_NETWORK_ID, Menu.NONE, R.string.network_setting);
    	nav_locally.setIcon(R.drawable.local_thumbnail);
    	nav_remote.setIcon(R.drawable.online_thumbnail);
    	setting.setIcon(R.drawable.setting);
    	
//    	MenuItem textMenu = menu.add(0, MenuHandler.TEXT_ID, Menu.NONE, R.string.text_input);
    	MenuHandler menuHandler = new MenuHandler(this);
    	nav_locally.setOnMenuItemClickListener(menuHandler);
    	nav_remote.setOnMenuItemClickListener(menuHandler);
    	setting.setOnMenuItemClickListener(menuHandler);
    	return super.onCreateOptionsMenu(menu);
    }

}

